@echo off
title Compress Desktop Shortcuts
echo ================================================
echo         Compress Desktop Shortcuts Tool
echo ================================================
echo.

:: Set desktop path
set "desktop_path=%USERPROFILE%\Desktop"

:: Define the output ZIP file path
set "output_zip=%desktop_path%\Shortcuts.zip"

:: Check if there are .lnk files on the desktop
echo Checking shortcut files on the desktop...
if not exist "%desktop_path%\*.lnk" (
    echo No shortcut files found.
    pause
    exit
)

:: Compress all .lnk files on the desktop into a ZIP file
echo Compressing shortcut files into a ZIP archive...
powershell -Command "& {Compress-Archive -Path '%desktop_path%\*.lnk' -DestinationPath '%output_zip%' -Force}"

:: Check if the ZIP file was created
if exist "%output_zip%" (
    echo Compression complete.
    echo ZIP file saved at: %output_zip%
) else (
    echo Compression failed. Please check for errors.
)

pause
exit
